package com.yowasa.xiuxian.engine.item.lingyao;

import com.yowasa.xiuxian.annoations.Item;
import com.yowasa.xiuxian.engine.item.ItemInterface;
import com.yowasa.xiuxian.entity.bo.user.UserAttr;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.bo.user.UserBattle;
import com.yowasa.xiuxian.entity.bo.user.UserConfig;
import com.yowasa.xiuxian.entity.enums.ItemTypeEnum;

import java.util.Date;

@Item(name = "玄牝重生丹", type = ItemTypeEnum.LING_YAO, price = 10000)
public class XuanPinChongShengDan implements ItemInterface {

    @Override
    public String desc() {
        return "散掉修为忘却记忆 回到20岁";
    }

    @Override
    public String effect(UserBO userBO) {
        //重制境界
        userBO.setStage(1);
        userBO.setLevel(0);
        //重制年龄
        userBO.setStartAt(new Date());
        //重制战斗属性
        userBO.setUserOriginBattle(UserBattle.genBattleAttr(userBO.getUserAttr()));
        userBO.setUserBattle(userBO.getUserOriginBattle());
        //重制配置项
        UserConfig orgConfig = userBO.getUserConfig();
        userBO.setUserConfig(new UserConfig());
        //保留金钱
        userBO.getUserConfig().setGold(orgConfig.getGold());
        //保留耐药性
        userBO.getUserConfig().setLingYaoTag(orgConfig.getLingYaoTag());
        userBO.setLockEndTime(new Date());

        return "失去所有记忆回到了20岁,请自行查看";
    }




}
